package com.tycg.muyu.chat.controller;

import com.tycg.muyu.chat.pojo.MFriend;
import com.tycg.muyu.chat.service.FriendService;
import com.tycg.muyu.commons.entity.Result;
import com.tycg.muyu.commons.entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by xiaowu on 2020/2/20
 */
@RestController
@RequestMapping("/friend")
public class FriendController {

    @Autowired
    private FriendService friendService;

    /**
     * 根据用户id查询好友
     */
    @PostMapping("/findByUid")
    public Result findByUid(Long uid) {

        List<MFriend> friends = friendService.findByUid(uid);

        return new Result(true, StatusCode.OK, "查询成功", friends);
    }


}
